#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 5e4+10;
const int mod = 10007;

int cnt[N],n,m,k;
ll f[1010][N],s[2][N];

ll calc(int x){return x * (x-1) / 2 % mod;}

ll qp(ll x,int t){ll res=1;for(;t;t>>=1,x=x*x%mod)if(t&1)res=res*x%mod;return res;}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,m = in,k = in;
	for(int i = 1,u,v;i <= m;i++){
		u = in,v = in; cnt[u]++,cnt[v]++;
	}
	int odd = 0; for(int i = 1;i <= n;i++) odd += cnt[i] & 1;
	f[0][odd] = 1;
	for(int i = 1;i <= k;i++){
		for(int j = 0;j <= n;j++){
			f[i][j] += f[i-1][j] * j * (n - j) % mod; f[i][j] %= mod;
			if(j >= 2) f[i][j] += f[i-1][j-2] * calc(n-j+2) % mod , f[i][j] %= mod;
			if(j + 2 <= n) f[i][j] += f[i-1][j+2] * calc(j+2) % mod, f[i][j] %= mod;
			if(i >= 2) f[i][j] = (f[i][j] - f[i-2][j] * (calc(n) - i + 2) % mod + mod) % mod;
			f[i][j] = f[i][j] * qp(i,mod-2) % mod;
		}
	}printf("%lld\n",f[k][0]);
	return 0;
}
